﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace ProyectoHCI
{
    public partial class Login : Plantilla
    {
        Registrarse R;
        Olvide O;
        usuario A;

        
        public Login()
        {
           
            //Creamos hilo con pantalla negra con el fin de centrar la aplicacion
            new Fondo(this).Visible = true;
            //Thread thread = new Thread(new ThreadStart(WorkThreadFunction));
            //thread.Start();
            //
            InitializeComponent();

        }

        //boton registrarse
        private void button2_Click(object sender, EventArgs e)
        {
            R = new Registrarse(this);
            R.Show();
            this.Hide();
         }

        //olvide contraseña
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            O = new Olvide(this);
            O.Show();
            this.Hide();

        }
        //metodo loguear
        private void logear()
        {
            if (usuario.Text.Equals("Usuario"))
            {//usuario
                A = new alumnoInicial(this);
                A.Show();
                this.Hide();
            }
            else //docente
            {
                (new PantallaDocente(this)).Visible = true;
                this.Hide();
            }
        }
        //boton iniciar sesion
        private void button1_Click(object sender, EventArgs e)
        {
            logear();

        }
        //iniciar sesion con enter
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Return))
           
                {
                    logear();

                }

                e.Handled = true;
        }
        //iniciar sesion con enter
        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Return))
            {
                    logear();
            }   
            e.Handled = true;
        }   
    }
}
